package com.github.jcooky.structure;

public interface Tree extends Collection {
	public interface Visitor {
		public void visit(Node v);
	}
	
	public interface Node {
		Object element();
		Node parent();
		List children();
	}
	
	public int size();
	public boolean isEmpty();
	public List elements();
	public List nodes();
	
	Node root();
	Node parent(Node v);
	List children(Node v);
	
	boolean isInternal(Node v);
	boolean isExternal(Node v);
	boolean isRoot(Node v);
	
	Object replace(Node v, Object e);
	
	void preOrder(Visitor visitor);
	void postOrder(Visitor visitor);
}
